package features.advance.ch3;

import java.net.InetAddress;

public class InetAddressTest {
    public static void main(String[] args) {
        String url = "www.github.com";
        //钓鱼网站
//        url = "aplw.apxwld.cn";
        try{
            InetAddress byName = InetAddress.getByName(url);
            System.out.println(byName);
            InetAddress[] allByName = InetAddress.getAllByName(url);
            for (int i = 0; i < allByName.length; i++) {
                System.out.println(allByName[i]);
            }
            InetAddress localHost = InetAddress.getLocalHost();
            System.out.println("本机地址："+localHost);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}

